<template>
  <div class="container">
    <div style="margin-top: 150px">
      <div style="font-size: 25px;font-weight: bold">重置密码</div>
      <div style="font-size: 14px;color:grey">请输入需要重置密码的电子邮箱地址</div>
    </div>
    <div>
      <el-form :model="form">
        <el-form-item prop="email">
          <el-input prefix-icon="el-icon-message" v-model="form.email" type="email" style="margin-top: 40px;width: 90%;" placeholder="电子邮箱地址">
          </el-input>
        </el-form-item>
        <el-form-item prop="code">
          <div style="width: 90%;margin: 20px 0 0 20px">
            <el-row :gutter="10" style="width: 100%">
              <el-col :span="18">
                <el-input v-model="form.code" type="text" placeholder="请输入验证码">
                </el-input>
              </el-col>
              <el-col :span="6">
                <el-button type="success" :maxlength="6">
                  获取验证码</el-button>
              </el-col>
            </el-row>
          </div>
        </el-form-item>
        <el-form-item prop="password">
          <el-input show-password prefix-icon="el-icon-lock" v-model="form.password" :maxlength="16" type="password" style="width: 90%;margin-top: 20px" placeholder="新密码">
          </el-input>
        </el-form-item>
        <el-form-item prop="password_repeat">
          <el-input show-password prefix-icon="el-icon-lock" v-model="form.password_repeat" :maxlength="16" type="password" style="width: 90%;margin-top: 20px"
            placeholder="再次输入新密码">
          </el-input>
        </el-form-item>
      </el-form>
    </div>
    <div style="margin-top: 40px">
      <el-button style="width: 270px;" type="danger" plain>立即重置密码</el-button>
    </div>
  </div>
</template>

<script>
import { validUsername } from '@/utils/validate'
import { ref } from "vue";

export default {
  name: 'Login',
  data() {
    const validateUsername = (rule, value, callback) => {
      if (!validUsername(value)) {
        callback(new Error('Please enter the correct user name'))
      } else {
        callback()
      }
    }
    const validatePassword = (rule, value, callback) => {
      if (value.length < 6) {
        callback(new Error('The password can not be less than 6 digits'))
      } else {
        callback()
      }
    }
    return {
      form: {
        email: "",
        code: "",
        username: "",
        password: "",
        password_repeat: ""
      },

    }
  },
  watch: {

  },
  methods: {
    backToLogin() {
      this.$router.push('/')
    }
  }
}
</script>

<style lang="scss">
/* 修复input 背景不协调 和光标变色 */
/* Detail see https://github.com/PanJiaChen/vue-element-admin/pull/927 */

</style>

<style lang="scss" scoped>

.container{
  text-align: center;
  height: 100%;
  background-color: rgb(252, 252, 241);
}

// .el-input__inner {
//   background-color: rgb(252, 252, 241);
// }
</style>
